using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text;
using System.Data; 
using yq.IBase; 
using yq.Dictionary; 
using yq.Basis; 
using yq.Model.Logic;
using System.Collections; 
using Db; 
using System.Data.Common;

namespace yq.Model.Base 
{
    ///<summary>
    /// Article_Template -  模版类别表 - 对象基础类
    /// </summary>
    ///<typeparam name="T"></typeparam>
    public abstract class IArticleTemplate<T> :ModelBase<ArticleTemplate> where T : ArticleTemplate, new()
    {
        /// <summary>
        /// 写入主键值
        /// </summary>
        /// <param name="Id">主键</param>
        protected internal override void SetKeyValue(dynamic Id)
        {
            this.TemplateId = Id;
        }

        /// <summary>
        /// 获取主键值
        /// </summary>
        /// <returns></returns>
        protected internal override dynamic GetKeyValue()
        {
            return TemplateId;
        }

        /// <summary>
        /// 为本对象赋值
        /// </summary>
        /// <param name="dy"></param>
        public override void SetValue(dynamic dy) 
        {
           this.TemplateId=dy.TemplateId;
           this.TemplateName=dy.TemplateName;
           this.Explain=dy.Explain;
        } 

        #region 定义属性

     
         /// <summary>
        /// 模版ID
        /// </summary>
        private int _TemplateId =int.MinValue;
      
        /// <summary>
        /// 模版ID
        /// </summary>
        public int TemplateId
        {
            get 
            {
              return   (this._TemplateId); 
            }

            set 
            {
                    _TemplateId= value;  
            }
        }
       
     
         /// <summary>
        /// 模版名称
        /// </summary>
        private String _TemplateName = "";
      
        /// <summary>
        /// 模版名称
        /// </summary>
        public String TemplateName
        {
            get 
            {
              return   (this._TemplateName); 
            }

            set 
            {
                    _TemplateName= value;  
            }
        }
       
     
         /// <summary>
        /// 模版说明
        /// </summary>
        private String _Explain = "";
      
        /// <summary>
        /// 模版说明
        /// </summary>
        public String Explain
        {
            get 
            {
              return   (this._Explain); 
            }

            set 
            {
                    _Explain= value;  
            }
        }
       

      #endregion 定义属性 

          protected internal override void SetValue(ArticleTemplate info, DataRow row) 
          { 
               if (row == null) 
               { 
                 info.IsLoad = false; 
               }
               else 
               { 
                  info.IsLoad = true; 
                  
                  if(row["TemplateId"]!= DBNull.Value)
                  {
                  info.TemplateId=Convert.ToInt32(row["TemplateId"]);
                 }
                 
                  
                  if(row["TemplateName"]!= DBNull.Value)
                  {
                  info.TemplateName=row["TemplateName"].ToString();
                 }
                 
                  
                  if(row["Explain"]!= DBNull.Value)
                  {
                  info.Explain=row["Explain"].ToString();
                 }
                 
               } 

          } 

        protected internal override void GetDbParameters(DbCommand comm, ArticleTemplate info, DbHelper cn) 
        { 
             
                cn.AddInParameter(comm, "@TemplateId", DbType.Int32,ParameterTool.GetObj( info._TemplateId )); 
            
             
                cn.AddInParameter(comm, "@TemplateName", DbType.String,ParameterTool.GetObj( info._TemplateName )); 
            
             
                cn.AddInParameter(comm, "@Explain", DbType.String,ParameterTool.GetObj( info._Explain )); 
            
        } 

    } 
} 